home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Magazine / GraphicsCards / StormMesa / mklib.linux < prev    next >
Text File  |  1998-12-15  |  2KB  |  69 lines

  1. #!/bin/sh
  2.  
  3. # Make a Linux ELF shared library
  4.  
  5. #--identification------------------------------------------------------
  6.  
  7. # $Id: mklib.linux,v 1.8 1997/10/21 23:32:31 brianp Exp $
  8.  
  9. # $Log: mklib.linux,v $
  10. # Revision 1.8  1997/10/21 23:32:31  brianp
  11. # now takes major and minor version arguments
  12. #
  13.  
  14. #--common--------------------------------------------------------------
  15.  
  16. # Usage:  mklib libname major minor file.o ...
  17. #
  18. # First argument is name of output library (LIBRARY)
  19. # Second arg is major version number (MAJOR)
  20. # Third arg is minor version number (MINOR)
  21. # Rest of arguments are object files (OBJECTS)
  22.  
  23. LIBRARY=$1
  24. shift 1
  25.  
  26. MAJOR=$1
  27. shift 1
  28.  
  29. MINOR=$1
  30. shift 1
  31.  
  32. OBJECTS=$*
  33.  
  34. #--platform------------------------------------------------------------
  35.  
  36. # the following provided by Thomas Hiller (Hiller@tu-harburg.d400.de)
  37.  
  38. VERSION="${MAJOR}.${MINOR}"
  39.  
  40. LIBNAME=`basename $LIBRARY`
  41. ARNAME=`basename $LIBNAME .so`.a
  42. DIRNAME=`dirname $LIBRARY`
  43.  
  44. gcc -shared -Wl,-soname,${LIBNAME}.${MAJOR} -o ${LIBRARY}.${VERSION} ${OBJECTS}
  45. (cd $DIRNAME; ln -s ${LIBNAME}.${VERSION} ${LIBNAME}.${MAJOR})
  46.  
  47. ln -s ${LIBNAME}.${MAJOR} ${LIBRARY}
  48.  
  49.  
  50. # also make regular .a files,
  51. # provided by Danek Duvall (duvall@dhduvall.student.princeton.edu)
  52.  
  53. ar ruv ${DIRNAME}/${ARNAME} ${OBJECTS}
  54. ranlib ${DIRNAME}/${ARNAME}
  55.  
  56.  
  57. # Print a reminder about shared libs:
  58. DIR=`cd .. ; pwd`
  59. echo
  60. echo "******Be sure to add" ${DIR}"/lib to your LD_LIBRARY_PATH variable"
  61. echo
  62. sleep 2
  63.  
  64.  
  65.  
  66. #### NOTES:
  67. # One Mesa user reports having to run the "ldconfig -v" command to make
  68. # Linux aware of the shared libs.
  69.